﻿<SaturnExplorer:ChromeWindow x:Class="SaturnExplorer.ApplicationWindow"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:SaturnExplorer="clr-namespace:SaturnExplorer" mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
            Title="Saturn Prototype"
            Width="1000" Height="600"
                              RenderOptions.BitmapScalingMode="NearestNeighbor"
            MinWidth="250" MinHeight="100" 
            TextOptions.TextFormattingMode="Display"
                             WindowStartupLocation="CenterScreen">
	<Window.Resources>
		<ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/Main.xaml" />
                <ResourceDictionary Source="Resources/ScrollBarStyle.xaml" />
            </ResourceDictionary.MergedDictionaries>
		</ResourceDictionary>
	</Window.Resources>
	<Window.Style>
		<Style TargetType="{x:Type SaturnExplorer:ApplicationWindow}">
			<Setter Property="ResizeMode" Value="CanResizeWithGrip" />
			<Setter Property="WindowStyle" Value="None" />
			<Setter Property="AllowsTransparency" Value="True" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Window}">
						<Border Background="{StaticResource MainWindowBackground}"
                                BorderBrush="{StaticResource MainWindowBorder}"
                                BorderThickness="1"
                                CornerRadius="5" x:Name="OuterBorder" >
							<Border BorderBrush="White" BorderThickness="1" CornerRadius="5" x:Name="InnerBorder">
								<Grid>
									<Grid.RowDefinitions>
										<RowDefinition Height="26" />
										<RowDefinition />
									</Grid.RowDefinitions>
									<Grid x:Name="PART_Title" Background="{StaticResource MainWindowTitleBackground}">
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="*"/>
											<ColumnDefinition Width="Auto" />
										</Grid.ColumnDefinitions>
                                        
                                        <TextBlock Grid.Column="0" Text="{TemplateBinding Title}" VerticalAlignment="Center" TextAlignment="Center" Foreground="{StaticResource GrayBrush}" FontSize="18" FontFamily="Calibri"/>
                                        <StackPanel Grid.Column="1" x:Name="PART_ButtonsPanel" HorizontalAlignment="Right" Margin="0,7,3,0" VerticalAlignment="Top" Orientation="Horizontal" >
											<SaturnExplorer:CaptionButton x:Name="MinimizeButton" Width="25" Height="18" BorderThickness="1,0,0,1" Command="{x:Static SaturnExplorer:ApplicationWindow.MinimizeCommand}">
												<Image Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Source="{StaticResource ApplicationMinimize}" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
											</SaturnExplorer:CaptionButton>
											<SaturnExplorer:CaptionButton x:Name="MaximizeButton" Margin="0,0,0,0" Width="25" Height="18" BorderThickness="0,0,0,1" Command="{x:Static SaturnExplorer:ApplicationWindow.MaximizeCommand}">
												<Image Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Source="{StaticResource ApplicationMaximize}" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
											</SaturnExplorer:CaptionButton>
											<SaturnExplorer:CaptionButton x:Name="NormalizeButton" Margin="0,0,0,0" Width="25" Height="18" BorderThickness="0,0,0,1" Command="{x:Static SaturnExplorer:ApplicationWindow.NormalizeCommand}">
												<Image Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Source="{StaticResource ApplicationNormalize}" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
											</SaturnExplorer:CaptionButton>
											<SaturnExplorer:CaptionButton x:Name="CloseButton" Margin="0,0,0,0" Width="25" Height="18" BorderThickness="0,0,1,1" Background="Red" Command="{x:Static SaturnExplorer:ApplicationWindow.CloseApplicationCommand}">
												<Image Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" Source="{StaticResource ApplicationClose}" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="NearestNeighbor"/>
											</SaturnExplorer:CaptionButton>
										</StackPanel>
									</Grid>
									<AdornerDecorator Grid.Row="1">
                                        <Grid Background="#DDE3E9">
											<Grid>
												<Grid.RowDefinitions>
                                                    <RowDefinition Height="1"/>
													<RowDefinition Height="Auto"/>
													<RowDefinition Height="6"/>
													<RowDefinition Height="*"/>
												</Grid.RowDefinitions>
                                                <Rectangle Grid.Row="0" Height="1" Stroke="#CCCCCC" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="-1,0,-1,0"/>
											
                                                <Rectangle Grid.Row="2" Height="6" Stroke="{StaticResource MainWindowTopDelimiter}" StrokeThickness="0" VerticalAlignment="Center" HorizontalAlignment="Stretch">
                                                    <Rectangle.Fill>
                                                        <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                                                            <GradientStop Color="#93969A" Offset="0"/>
                                                            <GradientStop Color="#DDE3E9" Offset="1"/>
                                                        </LinearGradientBrush>
                                                    </Rectangle.Fill>
                                                </Rectangle>
                                                <Border Grid.Row="3">
                                                    <ContentPresenter Content="{TemplateBinding Content}" Margin="0 0 0 25"/>
												</Border>
											</Grid>
                                            <ResizeGrip x:Name="PART_ResizeGrip" HorizontalAlignment="Right" Cursor="SizeNWSE"
                                                        VerticalAlignment="Bottom" Width="17" Height="17" Focusable="False" Margin="0,0,6,6"/>
										</Grid>
									</AdornerDecorator>
								</Grid>
							</Border>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="WindowState" Value="Maximized">
								<Setter Property="Visibility" TargetName="MaximizeButton" Value="Collapsed"/>
								<Setter Property="BorderThickness" TargetName="InnerBorder" Value="0"/>
								<Setter Property="CornerRadius" TargetName="InnerBorder" Value="0"/>
								<Setter Property="BorderThickness" TargetName="OuterBorder" Value="0"/>
								<Setter Property="CornerRadius" TargetName="OuterBorder" Value="0"/>
								<Setter Property="Visibility" TargetName="PART_ResizeGrip" Value="Hidden"/>
							</Trigger>
							<Trigger Property="WindowState" Value="Normal">
								<Setter Property="Visibility" TargetName="NormalizeButton" Value="Collapsed"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</Window.Style>
</SaturnExplorer:ChromeWindow>
